﻿using Tiny.Imaging.Filter.PixelLibrary;

namespace Tiny.Imaging.Filter.BaseFilter
{
    public abstract class BaseLayerFilter : BaseFilter
    {
        public override int[] Apply(int[] pixels)
        {
            var results = new int[pixels.Length];
            for (int i = 0; i < pixels.Length; ++i)
            {
                results[i] = ProcessFilter(i, new Pixel(0, 0, Rgba.Parse(pixels[i]))).ToInteger();
            }

            return results;
        }

        internal abstract Rgba ProcessFilter(int idx, Pixel pixel);
    }
}